<?php

/**
 * CountryLkup form.
 *
 * @package    simpleERP
 * @subpackage form
 * @author     Rommel M. Zamora
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class FormCustomError
{
    static function processCustomError(sfForm $form)
    {
      $estring = null;
      foreach( $form->getGlobalErrors() as $name => $error ) :
      	if(isset($form["$name"]))
            $estring = '<li><b>'.ucwords($form["$name"]->renderLabelName()).'</b>: '.$error."</li>";
      endforeach;

      foreach($form->getErrorSchema()->getErrors() as $name => $error) :
        if(isset($form["$name"]))
      	     $estring .= '<li><b>'.ucwords($form["$name"]->renderLabelName()).'</b>: '.$error."</li>";
      endforeach;

      return $estring;
    }
}